﻿Imports System.IO
Imports System.Configuration.ConfigurationManager
Imports Slythe.FileSystemProfiler.ProfilerService.Models



Namespace Serialisation



    Public Class SerialiseDriveStructure



#Region "Private Members"



        Private Property DriveContentsInformation As DriveContentsInformationModel



#End Region



#Region "Enums"



        Public Enum SerialisationResultEnum
            UNKNOWN = 0
            CREATED = 1
            FAILED = 2
        End Enum



#End Region



#Region "Public Properties"



        Public Property SerialisationResult As SerialisationResultEnum


        Public Property SerialisedFileInfo As FileInfo


        Public Property ErrorInformation As String



#End Region



#Region "Constructors"



        Public Sub New(ByVal DriveContents As DriveContentsInformationModel)


            SerialisationResult = SerialisationResultEnum.UNKNOWN
            SerialisedFileInfo = Nothing
            ErrorInformation = String.Empty


            Me.DriveContentsInformation = DriveContents


        End Sub



#End Region



#Region "Serialisation"



        Public Sub Start()


            Dim serialisationFormat As String = _
                AppSettings("Serialisation.Format").ToString.ToUpper.Trim


            Select Case serialisationFormat

                Case "XML"

                    Serialisation_XML.serialiseAll(DriveContentsInformation.Files, _
                                                   DriveContentsInformation.Directories)



            End Select


        End Sub



#End Region



    End Class



End Namespace